Skip to content

feat: TLS support for ember-cli - #83

Merged
kacy merged 4 commits into
mainfrom
feat/cli-tls
Feb 10, 2026
Merged

feat: TLS support for ember-cli#83
kacy merged 4 commits into
mainfrom
feat/cli-tls

Conversation

@kacy

@kacy kacy commented Feb 10, 2026

Copy link
Copy Markdown
Owner

summary

wires up actual TLS client connections so ember-cli can connect to TLS-enabled servers. the --tls flag previously printed "tls is not yet supported" and exited — now it performs a real TLS handshake using rustls.

the approach uses a MaybeTlsStream enum that wraps either a plain TcpStream or a TlsStream<TcpStream>, implementing AsyncRead and AsyncWrite for transparent dispatch. every code path that creates a connection (REPL, one-shot, cluster, benchmark) accepts an optional TlsClientConfig and passes it through.

new CLI flags:

  • --tls — enable TLS
  • --tls-ca-cert <path> — custom CA certificate (PEM) for server verification; defaults to the system trust store
  • --tls-insecure — skip certificate verification (prints a warning to stderr)

what was tested

  • cargo clippy --workspace -- -D warnings — zero warnings
  • cargo test --workspace — all tests pass (80 CLI tests + full workspace)
  • manual verification planned with self-signed certs once merged

design considerations

  • enum vs trait object: went with MaybeTlsStream enum over Box<dyn AsyncRead + AsyncWrite> to avoid heap allocation on every connection and keep the dispatch branch-predictable on the hot path.
  • rustls-native-certs for loading the system trust store — avoids shipping bundled CA certs and stays in sync with the OS.
  • NoVerifier for --tls-insecure matches the redis-cli --tls --insecure behavior. always prints a warning to stderr when active.
  • Box<TlsStream> inside the enum to keep the Plain variant small — TlsStream is significantly larger than TcpStream.

kacy added 4 commits February 10, 2026 10:54
adds rustls-native-certs to the workspace and TLS dependencies to
the CLI crate. introduces a new tls.rs module with:

- TlsClientConfig struct for CLI TLS options
- MaybeTlsStream enum wrapping plain TCP or TLS connections
- AsyncRead/AsyncWrite implementations for transparent dispatch
- connect() function supporting system roots, custom CA, and
  insecure mode (with NoVerifier for self-signed certs)
replaces raw TcpStream with MaybeTlsStream in Connection and
BenchConnection. adds --tls-ca-cert and --tls-insecure CLI flags.
removes the "tls not yet supported" early-exit stub and passes
TlsClientConfig through REPL, one-shot, cluster, and benchmark modes.
removes "TLS coming soon" note from root README and updates the
TLS example to use ember-cli. adds a TLS section to the CLI README
with examples for custom CA, insecure mode, REPL, and benchmarks.
updates the options table with the new --tls-ca-cert and
--tls-insecure flags.
@kacy
kacy merged commit 8f9680c into main Feb 10, 2026
7 checks passed
@kacy
kacy deleted the feat/cli-tls branch February 10, 2026 15:57
kacy added a commit that referenced this pull request Feb 11, 2026
* feat: add TLS client module for ember-cli

adds rustls-native-certs to the workspace and TLS dependencies to
the CLI crate. introduces a new tls.rs module with:

- TlsClientConfig struct for CLI TLS options
- MaybeTlsStream enum wrapping plain TCP or TLS connections
- AsyncRead/AsyncWrite implementations for transparent dispatch
- connect() function supporting system roots, custom CA, and
  insecure mode (with NoVerifier for self-signed certs)

* feat: wire TLS support through all CLI code paths

replaces raw TcpStream with MaybeTlsStream in Connection and
BenchConnection. adds --tls-ca-cert and --tls-insecure CLI flags.
removes the "tls not yet supported" early-exit stub and passes
TlsClientConfig through REPL, one-shot, cluster, and benchmark modes.

* docs: update READMEs for CLI TLS support

removes "TLS coming soon" note from root README and updates the
TLS example to use ember-cli. adds a TLS section to the CLI README
with examples for custom CA, insecure mode, REPL, and benchmarks.
updates the options table with the new --tls-ca-cert and
--tls-insecure flags.

* style: fix rustfmt formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant